<template>
  <div class="dashboard-editor-container">
    <div>
      <el-card>
        <el-form :model="ruleForm" style="margin-top:10px;" size="mini" label-position="top" ref="ruleForm">
          <el-row :gutter="10">
            <el-col :lg="4" :md="6">
              <el-form-item label="批次号" prop="BATCHNO">
               <!-- <el-select v-model="ruleForm.BATCHNO" size="mini" clearable placeholder="请选择批次号">
                   <el-option v-for="item in batchOption" :key="item.BATCHNO" :label="item.BATCHNO"
                    :value="item.BATCHNO"></el-option>
                </el-select> -->
                <el-input v-model="ruleForm.BATCHNO"  placeholder="请选择批次号" size="mini"></el-input>
              </el-form-item>
            </el-col>
            <el-col :lg="4" :md="6">
              <el-form-item label="质检员" prop="QUALITER">
                <el-input size="mini" placeholder="请输入质检员" v-model="ruleForm.QUALITER"></el-input>
              </el-form-item>
            </el-col>
            <el-col :lg="4" :md="6">
              <el-form-item label="开始日期" prop="OPERABEGINDATE">
                <el-date-picker size="mini" style="width:100%;" v-model="ruleForm.OPERABEGINDATE" type="date"
                  value-format="yyyyMMdd" :clearable='false' placeholder="开始日期" :picker-options="pickerOptionsStart"
                  @change="changeStart">
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :lg="4" :md="6">
              <el-form-item label="结束日期" prop="OPERAENDDATE">
                <el-date-picker style="width:100%;" size="mini" v-model="ruleForm.OPERAENDDATE" type="date"
                  value-format="yyyyMMdd" placeholder="结束日期" :picker-options="pickerOptionsEnd" @change="changeEnd"
                  :clearable='false'>
                </el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :lg="6" :md="9" class="searchBtnMarginTop" :offset="2">
              <el-button type="primary" icon="el-icon-search" :loading="loading" size="mini" @click="queryDetail">查询
              </el-button>
              <el-button type='warning' size='mini' icon='el-icon-refresh' @click="clearForm('ruleForm')">重置</el-button>
            </el-col>
          </el-row>
        </el-form>
      </el-card>
    </div>
    <el-row style="margin-top:20px">
      <el-col>
        <el-card>
          <el-row>
            <el-col :md="24" :lg="20">
              <el-button type="primary" size="mini" icon='el-icon-more'  :disabled="currentRow.length!=1" @click="detail">查看详情</el-button>
            </el-col>
          </el-row>
          <el-table :data="tableData" border highlight-current-row ref="tableData" @selection-change="handleCurrentChange">
            <el-table-column type="selection" width="40px"></el-table-column>
            <el-table-column prop='TASKID' label='任务号' align="center"></el-table-column>
            <el-table-column prop='OPERAWORKDATE' label='抽样日期' width="100" align="center"></el-table-column>
            <el-table-column prop='SAMPLFLAG' label='抽样方式' align="center" :formatter="dataFormat"></el-table-column>
            <el-table-column prop='SAMPLER' label='抽样人员' width="100" align="center"></el-table-column>
            <el-table-column prop='BATCHNO' label='采集批次号' width="100" align="center"></el-table-column>
            <el-table-column prop='BATCHDATE' label='采集日期' width="100" align="center"></el-table-column>
            <el-table-column prop='COLLECTSERNO' label='采集流水号' width="100" align="center"></el-table-column>
            <el-table-column prop='CHANNELTYPE' label='渠道类型' align="center" :formatter="dataFormat"></el-table-column>
            <el-table-column prop='TASKDATE' label='任务分配日期' align="center" width="100"></el-table-column>             
            <el-table-column prop='TASKBEGINDATE' label='任务规定开始日期' align="center" width="100"></el-table-column> 
            <el-table-column prop='TASKENDDATE' label='任务规定结束日期' align="center" width="100"></el-table-column> 
            <el-table-column prop='TASKSTATUS' label='任务状态' align="center" :formatter="dataFormat"></el-table-column>            
            <el-table-column prop='TASKFLAG' label='任务方式' align="center" :formatter="dataFormat"></el-table-column>
            <el-table-column prop='QUALITER' label='质检员' align="center" width="120"></el-table-column>
            <el-table-column prop='QUALITDATE' label='质检日期' align="center" width="120"></el-table-column>
            <el-table-column prop='SCORE' label='得分' align="center" width="120"></el-table-column>
            <el-table-column prop='APPEALFLAG' label='申诉标识' align="center" width="120" :formatter="dataFormat"></el-table-column>
            <!-- <el-table-column prop='TASKID' label='任务ID' align="center" width="100"></el-table-column>
            <el-table-column prop='BATCHNO' label='批次号' align="center" width="120"></el-table-column>
            <el-table-column prop='BATCHDATE' label='批次日期' align="center" width="100"></el-table-column>
            <el-table-column prop='SAMPLFLAG' label='抽样方式' align="center" :formatter="dataFormat" width="100">
            </el-table-column>
            <el-table-column prop='QUALITER' label='质检员' align="center"></el-table-column>
            <el-table-column prop='TASKFLAG' label='任务方式' align="center" :formatter="dataFormat"></el-table-column>
            <el-table-column prop='TASKSTATUS' label='任务状态' align="center" :formatter="dataFormat"></el-table-column>
            <el-table-column prop='BATCHDATE' label='采集日期' width="100" align="center"></el-table-column>
            <el-table-column prop='SESSIONID' label='会话ID' align="center" width="100"></el-table-column>
            <el-table-column prop='MEDIATYPE' label='多媒体类型' align="center" width="100"></el-table-column>
            <el-table-column prop='CHANNELTYPE' label='渠道类型' align="center"></el-table-column>
            <el-table-column prop='BUSINESSTYPE' label='业务类型' align="center"></el-table-column>
            <el-table-column prop='BEGINTIME' label='会话开始时间' align="center" width="110"></el-table-column>
            <el-table-column prop='ENDTIME' label='会话结束时间' align="center" width="110"></el-table-column>
            <el-table-column prop='SESSIONTIME' label='会话时长' align="center" width="110"></el-table-column>
            <el-table-column prop='COLLECTFLAG' label='采集方式' align="center"></el-table-column>
            <el-table-column prop='VALIDFLAG' label='有效标识' align="center"></el-table-column>
            <el-table-column prop='FILEPATH' label='音视频文件路径' align="center" width="120"></el-table-column>
            <el-table-column prop='SAMPLEFLAG' label='抽样标识' align="center"></el-table-column>
            <el-table-column prop='TASKID' label='任务号' align="center"></el-table-column>
            <el-table-column prop='CUSTOMER' label='客户姓名' align="center"></el-table-column>
            <el-table-column prop='CUSTOMLEVEL' label='客户等级' align="center"></el-table-column>
            <el-table-column prop='TELNUMBER' label='客户手机号' align="center" width="110"></el-table-column>
            <el-table-column prop='CUSTOMIDTYPE' label='证件类型' align="center"></el-table-column>
            <el-table-column prop='CUSTOMIDNO' label='客户证件号' align="center" width="120"></el-table-column>
            <el-table-column prop='CALLTYPE' label='呼叫类型' align="center"></el-table-column>
            <el-table-column prop='AREA' label='运营地区' align="center"></el-table-column>
            <el-table-column prop='AGENTID' label='坐席ID' align="center"></el-table-column>
            <el-table-column prop='AGENTNAME' label='坐席姓名' align="center"></el-table-column>
            <el-table-column prop='AGENTLEVEL' label='坐席级别' align="center"></el-table-column>
            <el-table-column prop='EXTNO' label='分机号' align="center"></el-table-column>
            <el-table-column prop='TEAM' label='班组' align="center"></el-table-column>
            <el-table-column prop='BRNO' label='机构号' align="center"></el-table-column>
            <el-table-column prop='SKILL' label='技能组' align="center"></el-table-column> -->
            <el-table-column fixed="right" label='评分' align="center" width="140">
              <template slot-scope="scope">
                <div>
                  <el-button v-if="scope.row.TASKSTATUS=='0'" icon="el-icon-edit" size="mini" type="primary" @click="openScore(scope.row,'add')">质检评分</el-button>
                  <el-button v-if="scope.row.TASKSTATUS=='1'" icon="el-icon-search" size="mini" type="primary" @click="openScore(scope.row,'detail')">查看评分</el-button>
                </div>
              </template>
            </el-table-column>
            <el-table-column fixed="right" label='案例' align="center" width="140">
              <template slot-scope="scope">
                <div>
                  <el-button v-if="scope.row.TASKSTATUS=='1'" icon="el-icon-plus" size="mini" type="success" @click="openCase(scope.row)">添加案例</el-button>
                </div>
              </template>
            </el-table-column>
          </el-table>
          <div style="text-align:right;margin-top:20px;" v-show="this.tableData">
            <el-pagination :current-page="currentPage" background @size-change="handleSizeChange"
              :page-sizes="[10,25,50,100]" :page-size="pageSize" layout="total,sizes, prev, pager, next, jumper"
              :total="tableTotal" @current-change="changePage"></el-pagination>
          </div>
        </el-card>
      </el-col>
    </el-row>
        <!-- <component :is="dialogList.editDialog" :option="editOptions" @refreshTable="queryDetail"></component> -->
  <!-- 新增案例 -->
    <el-dialog title="添加为案例" :visible.sync="caseIsShow" width="70%" :close-on-click-modal="false"
    @open="openDialog" @close="closeDialog('caseRuleForm')">
    <el-row :gutter="10">
      <el-form :model="caseRuleForm" size="small" :rules="rules" ref="caseRuleForm" label-width="100px" class="demo-ruleForm">
        <!-- <el-col :span="12">
            <el-form-item label="案例编号" prop="CASENO">
              <el-input size="small" placeholder="请输入案例编号" v-model="caseRuleForm.CASENO"></el-input>
            </el-form-item>
          </el-col> -->
          <el-col :span="12">
            <el-form-item label="案例名称" prop="CASENAME">
              <el-input size="small" placeholder="请输入案例名称" v-model="caseRuleForm.CASENAME"></el-input>
            </el-form-item>
          </el-col> 
          <el-col :span="12">
            <el-form-item label="案例类型" prop="CASETYPE">
              <el-select v-model="caseRuleForm.CASETYPE" filterable clearable placeholder="请选择案例类型">
                <el-option v-for="(item,index) in caseTypeOption" :key="index" :label="item.code+'—'+item.val" :value="item.code"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <!-- <el-col :span="12">
            <el-form-item label="生成方式" prop="CREATETYPE">
              <el-select v-model="caseRuleForm.CREATETYPE" filterable clearable placeholder="请选择生成方式">
                <el-option v-for="(item,index) in option.creatTypeOption" :key="index" :label="item.code+'—'+item.val" :value="item.code"></el-option>
              </el-select>
            </el-form-item>
          </el-col> -->
          <el-col :span="12">
            <el-form-item label="任务ID" prop="TASKID">
              <!-- <el-select v-model="caseRuleForm.TASKID" filterable clearable placeholder="请选择任务ID">
                <el-option v-for="(item,index) in taskIdOption" :key="index" :label="item.val" :value="item.val"></el-option>
              </el-select> -->
              <el-input placeholder="请输入任务ID" size="small" v-model="caseRuleForm.TASKID" disabled></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="文件类型" prop="FILETYPE">
              <el-select v-model="caseRuleForm.FILETYPE" disabled filterable clearable placeholder="请选择文件类型">
                <el-option v-for="(item,index) in fileTypeOption" :key="index" :label="item.code+'—'+item.val" :value="item.code"></el-option>
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="文件名称" prop="FILENAME">
              <el-input size="small" placeholder="请输入文件名称" disabled v-model="caseRuleForm.FILENAME"></el-input>
            </el-form-item>
          </el-col>
          <!-- <el-col :span="12">
            <el-form-item label="创建人" prop="CREATER">
              <el-input size="small" placeholder="请输入创建人" v-model="caseRuleForm.CREATER"></el-input>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="格式" prop="FILEFORMAT">
              <el-select v-model="caseRuleForm.FILEFORMAT" filterable clearable placeholder="请选择格式">
                <el-option v-for="(item,index) in option.fileFormatOption" :key="index" :label="item.val" :value="item.val"></el-option>
              </el-select>
            </el-form-item>
          </el-col> -->
          <el-col :span="12">
            <el-form-item label="案例描述" prop="CASEDESC">
              <el-input v-model="caseRuleForm.CASEDESC" type="textarea" placeholder="请输入案例描述" :rows="4"></el-input>
            </el-form-item>
          </el-col>
        
        <el-col :span="24">
          <el-form-item>
            <el-button type="primary" size="mini" @click="submitForm('caseRuleForm')">保存</el-button>
            <el-button @click="resetForm('caseRuleForm')" size="mini">重置</el-button>
          </el-form-item>
        </el-col>
      </el-form>
    </el-row>
  </el-dialog>
  <component :is="dialogList.detailDialog" :option="detailOptions"></component>
  </div>
</template>

<script>
  // 发送接口
  import request from "@/common/utils/requestQC";
  // import dictionary from '@/message/wfm/baseData/dictionaryManage/dictionaryQuery'
  // import requestWFM from "@/common/utils/requestWFM";
  import Query from '@/message/QCManage/taskAssignment/taskAssignmentDetail/taskAssignmentDetail';
  // import editDialog from "./dialog/scoreDialog";
  import scoreDetail from '@/message/QCManage/QCScore/queryDetail';
  import matchTemplate from '@/message/QCManage/QCScore/matchTemplate';
  import addData from "@/message/QCManage/caseManage/caseDataAdd";
  import detailDialog from "./dialog/detailDialog";

  //批量上传
  export default {
    name: '',
    data() {
      return {
        dialogList: {
          detailDialog,
        },
        detailOptions: {
          isShow: false,
          title: "",
          row: {}
        },
        currentRow: [],
        appealOption:[{'code':'0','value':'否'},{'code':'1','value':'是'}],
      samplOption:[{'code':'0','value':'自动'},{'code':'1','value':'手动'}],
      levelOption: [{
            code: '001',
            value: '非VIP'
          },
          {
            code: '002',
            value: 'VIP黄金级'
          },
          {
            code: '003',
            value: 'VIP铂金级'
          },
          {
            code: '004',
            value: 'VIP钻石级'
          },
        ],
        channelOption: [{
            code: 'C001',
            value: '电话'
          },
          {
            code: 'C002',
            value: '微信'
          },
          {
            code: 'C003',
            value: 'PAD'
          }],
        typeOption: [{
            code: '0',
            value: '账务类'
          },
          {
            code: '1',
            value: '签约类'
          },
          {
            code: '2',
            value: '信息维护类'
          },
          {
            code: '3',
            value: '账户类'
          },
          {
            code: '4',
            value: '理财类'
          },
        ],
        mediaOption: [{
            code: 'voice',
            value: '电话'
          },
          {
            code: 'video',
            value: '视频'
          },
          {
            code: 'chat',
            value: '文字'
          }],
        agentOption: [{
            code: '001',
            value: '一星'
          },
          {
            code: '002',
            value: '二星'
          },
          {
            code: '003',
            value: '三星'
          },
          {
            code: '004',
            value: '四星'
          },
          {
            code: '005',
            value: '五星'
          },
        ],
        taskOption: [{
            code: '0',
            value: '自动'
          },
          {
            code: '1',
            value: '手动'
          }
        ],
        taskStuatsOption: [{
            code: '0',
            value: '未开始'
          },
          {
            code: '1',
            value: '已完成'
          },
          {
            code: '2',
            value: '处理中'
          },
          {
            code: '3',
            value: '废弃'
          },
          {
            code: '4',
            value: '未分配'
          }
        ],
        fileTypeOption:[{ 'code': "video", 'val': "视频" },{ 'code': "voice", 'val': "语音" },{ 'code': "chat", 'val': "文字" }],
        caseTypeOption: [{ 'code': "0", 'val': "成功案例" }, {'code': "1", 'val': "失败案例"}],
         rules: {
          CASENAME: [{
            required: true,
            message: '请输入案例名称',
            trigger: 'change'
          }],
          CASEDESC: [{
            required: true,
            message: '请输入案例描述',
            trigger: 'change'
          }],
          CASETYPE: [{
            required: true,
            message: '请输入案例类型',
            trigger: 'change'
          }],
          CREATETYPE: [{
            required: true,
            message: '请输入生成方式',
            trigger: 'change'
          }],
          TASKID: [{
            required: true,
            message: '请输入任务ID',
            trigger: 'change'
          }],
          FILETYPE: [{
            required: true,
            message: '请输入文件类型',
            trigger: 'change'
          }],
          FILENAME: [{
            required: true,
            message: '请输入文件名称',
            trigger: 'change'
          }],
          CREATER: [{
            required: true,
            message: '请输入创建人',
            trigger: 'change'
          }],
          FILEFORMAT: [{
            required: true,
            message: '请输入格式',
            trigger: 'change'
          }]
          
        },
        caseIsShow:false,
        pickerOptionsStart: {
          disabledDate: (time) => {
            return time.getTime() > Date.now()
          }
        },
        pickerOptionsEnd: {
          disabledDate: (time) => {
            return time.getTime() > Date.now()
          }
        },
        // dialogList: {
        //   editDialog
        // },
        editOptions: {
          isShow: false,
          title: '',
          row: {},
          flag: ''
        },
        tableTotal: 0,
        pageSize: 10,
        currentPage: 1, //表格当前页
        tableData: [],
        ruleForm: {
          BATCHNO: '', //批次号
          QUALITER: '', //渠道
          OPERABEGINDATE: this.getDay(-6),
          OPERAENDDATE: this.getDay(0),
        },
        caseRuleForm:{
          CASENAME: '',//案例名称
          CASEDESC: '',//案例描述
          CREATETYPE: '1',
          TASKID: '',
          FILETYPE: '',
          FILENAME: '',
          CREATER: this.$store.getters.UserNum, //创建人
        },
        loading: false,
      }
    },
    computed: {},
    created() {},
    mounted() {
      this.queryDetail()
      // this.channelQuery()
      // this.batchQuery()
    },
    watch: {},
    methods: {
       //保存
      submitForm(formName) {
        this.$refs[formName].validate(async (valid) => {
          if (valid) {
            let resBody
            resBody = new addData();
            resBody.data.CASENO = ''
            resBody.data.CASENAME = this.caseRuleForm.CASENAME
            resBody.data.CASEDESC = this.caseRuleForm.CASEDESC
            resBody.data.CASETYPE = this.caseRuleForm.CASETYPE
            resBody.data.CREATETYPE = '1'
            resBody.data.TASKID = this.caseRuleForm.TASKID
            resBody.data.FILETYPE = this.caseRuleForm.FILETYPE
            resBody.data.FILENAME = this.caseRuleForm.FILENAME
            resBody.data.CREATER = this.caseRuleForm.CREATER
            resBody.data.FILEFORMAT = this.caseRuleForm.FILEFORMAT
            resBody.data.FILEPATH = this.caseRuleForm.FILEPATH
            
            let response = await request(resBody);
            if (response.SYS_HEAD.ReturnCode == "000000") {
              
                this.$message({
                  type: 'success',
                  message: '新增成功！'
                })
              
              this.isShow = false;
              this.$emit("refreshTable");
            } else {
              this.$message({
                type: "error",
                message: "请求失败，错误码:" + response.SYS_HEAD.ReturnCode + "，错误信息：" + response.SYS_HEAD
                  .ReturnMessage
              })
            }
          } else {
            console.log('error submit!!');
            return false;
          }
        });
      },
      resetForm(formName) {
        if (this.$refs[formName] != undefined) {
          this.$refs[formName].clearValidate();
          this.$refs[formName].resetFields();
        }
      },
      openDialog(){
         if(this.$refs['caseRuleForm'] != undefined){
          this.$refs['caseRuleForm'].clearValidate();
        }
      },
      closeDialog(formName) {
        if(this.$refs[formName] != undefined){
          this.$refs[formName].clearValidate();
        }
        // this.$refs[formName].clearValidate();
        this.$refs[formName].resetFields();
      },
      openCase(row){
        this.caseIsShow = true 
        console.log(row)
        this.caseRuleForm = JSON.parse(JSON.stringify(row))
        this.caseRuleForm.FILENAME = row.FILEPATH == ''?'':row.FILEPATH.substr(row.FILEPATH.lastIndexOf('/')+1)
        this.caseRuleForm.FILETYPE = row.MEDIATYPE
      },
      // 查看是否评分
      async openScore(row,flag){
        this.editOptions.flag = flag 
        if(flag == 'detail'){
          let resBody = new scoreDetail()
          resBody.data.TASKID = row.TASKID
          let response = await request(resBody);
          if (response.SYS_HEAD.ReturnCode == "000000") {
            let res = response.BODY.DTL1
            if(res.length > 0){
              // this.editOptions.title = '查看评分明细'
              // this.editOptions.response = response.BODY
              // this.editOptions.row = row
              this.$router.push({
                name: 'scoreOperate',
                params: {
                  title: '查看评分明细',
                  row:row,
                  response:response.BODY,
                  flag:flag
                }
              });
              
            }
          } else {
            this.$message({
              type: "error",
              message: "请求失败，错误码:" + response.SYS_HEAD.ReturnCode + "，错误信息：" + response.SYS_HEAD.ReturnMessage
            })
          }
        }else{
          let resBody = new matchTemplate()
          resBody.data.CHANNELTYPE = row.CHANNELTYPE
          resBody.data.BUSINESSTYPE = row.BUSINESSTYPE
          resBody.data.TRANSCODE = row.TRANSCODE == undefined?'':row.TRANSCODE
          let response = await request(resBody);
          if (response.SYS_HEAD.ReturnCode == "000000") {
            // this.editOptions.response = response.BODY
            // this.editOptions.title = '质检评分'
            // this.editOptions.isShow = true
            // this.editOptions.row = row
            this.$router.push({
                name: 'scoreOperate',
                params: {
                  title: '质检评分',
                  row:row,
                  response:response.BODY,
                  flag:flag
                }
              });
          } else {
            this.$message({
              type: "error",
              message: "请求失败，错误码:" + response.SYS_HEAD.ReturnCode + "，错误信息：" + response.SYS_HEAD.ReturnMessage
            })
          }
        }
      },
      dataFormat(row, column) {
        //格式化表格
        if (column.property == "CUSTOMLEVEL")
          // 001-非VIP 002-VIP黄金级 003-VIP铂金级 004-VIP钻石级
          return row[column.property]=='001'?'非VIP':row[column.property]=='002'?'VIP黄金级':row[column.property]=='003'?'VIP铂金级':row[column.property]=='004'?'VIP钻石级':row[column.property];
        
        if (column.property == "CUSTOMIDTYPE")
          // 001-身份证 002-军官证 003-其他
          return row[column.property]=='001'?'身份证':row[column.property]=='002'?'军官证':row[column.property]=='003'?'其他':row[column.property];
        
        if (column.property == "CALLTYPE")
          // 0-呼出 1-呼入
          return row[column.property]=='0'?'呼出':row[column.property]=='1'?'呼入':row[column.property];
        
        if (column.property == "AGENTLEVEL")
          // 001-一星 002-二星 003-三星 004-四星 005-五星
          return row[column.property]=='001'?'一星':row[column.property]=='002'?'二星':row[column.property]=='003'?'三星':row[column.property]=='004'?'四星':row[column.property]=='005'?'五星':row[column.property];
        
        if (column.property == "MEDIATYPE")
          // voice-电话 video-视频 chat-文字
          return row[column.property]=='voice'?'电话':row[column.property]=='video'?'视频':row[column.property]=='chat'?'文字':row[column.property];
        
        if (column.property == "CHANNELTYPE")
          // C001-电话  C002-微信  C003-PAD
          return row[column.property]=='C001'?'电话':row[column.property]=='C002'?'微信':row[column.property]=='C003'?'PAD':row[column.property];

        if (column.property == "BUSINESSTYPE")
          // 0-账务类 1-签约类 2-信息维护类 3-账户类 4-理财类，多个业务类型用“|”分隔
          return row[column.property]=='0'?'账务类':row[column.property]=='1'?'签约类':row[column.property]=='2'?'信息维护类':row[column.property]=='3'?'账户类':row[column.property]=='4'?'理财类':row[column.property];
        
        if (column.property == "SAMPLFLAG"||column.property == "COLLECTFLAG" || column.property == "TASKFLAG")
          // 0-自动 1-手动
          return row[column.property]=='0'?'自动':row[column.property]=='1'?'手动':row[column.property];
        
        if (column.property == "TASKSTATUS")
          // 0-未开始 1-已完成 2-处理中 3-废弃 4-未分配
          return row[column.property]=='0'?'未开始':row[column.property]=='1'?'已完成':row[column.property]=='2'?'处理中':row[column.property]=='3'?'废弃':row[column.property]=='4'?'未分配':row[column.property];
        if (column.property == "APPEALFLAG")
          return row[column.property]=='0'?'否':row[column.property]=='1'?'是':row[column.property]
      },
      //  // 查询业务渠道
      // async channelQuery() {
      //   let resBody = new dictionary();
      //   resBody.data.FIELDCODE = 'QUALITER'
      //   resBody.data.CurrPage = 1
      //   resBody.data.PageRowNum = 100
      //   let response = await requestWFM(resBody);
      //   if (response.SYS_HEAD.ReturnCode == "000000") {
      //     this.channelOption = response.BODY.FIEDATA;
      //   } else {
      //     this.$message({
      //       type: "error",
      //       message: "请求失败，错误码:" + response.SYS_HEAD.ReturnCode + "，错误信息：" + response.SYS_HEAD.ReturnMessage
      //     })
      //   }
      // },
      // 任务分发明细查询
      async queryDetail() {
        let resBody = new Query()
        resBody.data.QUALITER = this.ruleForm.QUALITER
        resBody.data.BATCHNO = this.ruleForm.BATCHNO
        resBody.data.OPERABEGINDATE = this.ruleForm.OPERABEGINDATE
        resBody.data.OPERAENDDATE = this.ruleForm.OPERAENDDATE
        resBody.data.CurrPage = this.currentPage + ''
        resBody.data.PageRowNum = this.pageSize + ''
        let response = await request(resBody);
        if (response.SYS_HEAD.ReturnCode == "000000") {
          this.tableData = response.BODY.RSPSTRUCT
          this.tableTotal = response.BODY.TotalRowNum
        } else {
          this.$message({
            type: "error",
            message: "请求失败，错误码:" + response.SYS_HEAD.ReturnCode + "，错误信息：" + response.SYS_HEAD.ReturnMessage
          })
        }
      },
      changePage(val) {
        this.currentPage = val;
        this.queryDetail()
      },
      handleSizeChange(val) {
        this.pageSize = val
        this.queryDetail()
      },
      // 获取当天前一天
      getDay(day) {
        var dd = new Date();
        dd.setDate(dd.getDate() + day);
        var y = dd.getFullYear();
        var m = dd.getMonth() + 1 < 10 ? "0" + (dd.getMonth() + 1) : dd.getMonth() + 1;
        var d = dd.getDate() < 10 ? "0" + dd.getDate() : dd.getDate();
        return y + "" + m + "" + d;
      },
      //  开始日期
      changeStart() {
        this.pickerOptionsEnd = Object.assign({}, this.pickerOptionsEnd, {
          disabledDate: (time) => {
            if (this.ruleForm.OPERABEGINDATE) {
              return time.getTime() < Date.parse(this.ruleForm.OPERABEGINDATE.slice(0, 4) + '-' + this.ruleForm
                .OPERABEGINDATE.slice(4, 6) +
                '-' + this.ruleForm.OPERABEGINDATE.slice(6, 8)) - 8.64e7 || time.getTime() > Date.now();
            } else {
              return time.getTime() > Date.now();
            }
          }
        })
      },
      // 结束日期
      changeEnd() {
        this.pickerOptionsStart = Object.assign({}, this.pickerOptionsStart, {
          disabledDate: (time) => {
            if (this.ruleForm.OPERAENDDATE) {
              return time.getTime() > Date.parse(this.ruleForm.OPERAENDDATE.slice(0, 4) + '-' + this.ruleForm
                .OPERAENDDATE
                .slice(4, 6) + '-' +
                this.ruleForm.OPERAENDDATE.slice(6, 8)) || time.getTime() > Date.now();
            } else {
              return time.getTime() > Date.now();
            }
          }
        })
      },
      // 重置查询条件
      clearForm(item) {
        // 重置表格
        this.$refs["" + item].resetFields();
      },
      detail(){
        this.detailOptions.row = this.currentRow;
        this.detailOptions.title = '质检评分详情';
        this.detailOptions.isShow = true;
      },
      handleCurrentChange(val) {
        this.currentRow = val;
        console.log("===="+JSON.stringify(this.currentRow))
      },
    }
  }

</script>

<style rel="stylesheet/scss" lang="scss" scoped>

</style>
